package com.wk.springboot.dispatch;

import com.wk.springboot.entity.LocalMessage;
import com.wk.springboot.parse.EndpointConfigParser;
import com.wk.springboot.parse.config.KafkaEndpointConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class KafkaSender implements MessageSender {
    @Value("${message.kafka.topic}")
    private String defaultTopic;

    private EndpointConfigParser endpointConfigParser;
    
    @Override
    public boolean send(LocalMessage message) {
        try {
            KafkaEndpointConfig config = endpointConfigParser.parseConfig(message.getContent(), KafkaEndpointConfig.class);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        // 实际发送逻辑...
        return true;
    }
}